Skip to content

resolve node name fallback on published/node ip as fallback#1012

Merged
pickypg merged 2 commits into
elastic:mainfrom
jguay:fallback-published-address-for-node-matching
Jul 2, 2026
Merged

resolve node name fallback on published/node ip as fallback#1012
pickypg merged 2 commits into
elastic:mainfrom
jguay:fallback-published-address-for-node-matching

Conversation

@jguay

@jguay jguay commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

close #436

When using 0.0.0.0 in network.host (or other networking settings - note 0.0.0.0 is default if security auto-configuration was used), the node match for local or remote elasticsearch cluster diagnostics types fail because:

  • findTargetNode() only compares local NIC addresses against node.boundAddresses
  • boundAddresses is empty for all nodes The code never falls back to comparing against node.httpPublishAddr or node.ip — even though it's likely containing the information needed for a positively match of the node

Reproduction on 9.3.1 support-diagnostics

1- Download latest elasticsearch, in my case I used elasticsearch-9.4.3-darwin-aarch64.tar.gz
2- add following to conf/elasticsearch.yml :

cluster.name: test
network.host: 0.0.0.0
node.name: randomname #note this does not match at all my actual hostname

3- run bin/elasticsearch, this will give elastic password you will need in next step

4- run diagnostics with ./diagnostics.sh --type local -u elastic --password --ssl --bypassDiagVerify --noVerify

5- note diagnostics.log cannot match the node so does not attempt to include logs or run system calls :

11:55:59.330 [main] INFO  co.elastic.support.diagnostics.commands.CheckPlatformDetails - Checking the supplied hostname against the node information retrieved to verify location. This may take some time.
11:56:59.511 [main] ERROR co.elastic.support.diagnostics.commands.CheckPlatformDetails - Comparison did not result in an IP or Host match. [fe80:0:0:0:5c2e:94ff:fedd:8dc8%awdl0, 2a00:23c6:6066:5101:0:0:0:96a%en0, en0, fe80:0:0:0:5c2e:94ff:fedd:8dc8%llw0, juliensm4.local, llw0, 2a00:23c6:6066:5101:463:938e:e980:2874%en0, lo0, 192.168.1.183, mac.lan, 2a00:23c6:6066:5101:e486:c392:33bf:f82d%en0, fe80:0:0:0:49f0:49f2:1d91:6205%utun2, fe80:0:0:0:8c0:88b1:52ce:ac4f%en0, 0:0:0:0:0:0:0:1%lo0, fe80:0:0:0:0:0:0:1%lo0, fe80:0:0:0:7b73:359e:b316:ef20%utun0, utun3, awdl0, utun2, fe80:0:0:0:24aa:2e47:504:fcff%utun1, fe80:0:0:0:ce81:b1c:bd2c:69e%utun3, utun1, utun0, Julien’s-M4] [ProcessProfile{isHttp=true, isDocker=false, currentMaster=false, name='randomname', id='Lv7snNC3QsSTVRK_2aSMJw', pid='12926', jvmPid='', logDir='/Users/julien/Downloads/elasticsearch-9.4.3/logs', networkHost='0.0.0.0', host='192.168.1.183', ip='192.168.1.183', httpPublishAddr='192.168.1.183', httpPort=9200, os='macOS', boundAddresses=[[], javaPlatform=co.elastic.support.diagnostics.JavaPlatform@41aaedaa}]
11:56:59.512 [main] ERROR co.elastic.support.diagnostics.commands.CheckPlatformDetails - Error: Could not find the target node.
11:56:59.513 [main] ERROR co.elastic.support.diagnostics.commands.CheckPlatformDetails - Error checking node metadata and deployment info.
java.lang.RuntimeException: Could not find the target node.
	at co.elastic.support.diagnostics.commands.CheckPlatformDetails.findTargetNode(CheckPlatformDetails.java:355) ~[diagnostics-9.3.1.jar:9.3.1]
	at co.elastic.support.diagnostics.commands.CheckPlatformDetails.findLocalTargetNode(CheckPlatformDetails.java:319) ~[diagnostics-9.3.1.jar:9.3.1]
	at co.elastic.support.diagnostics.commands.CheckPlatformDetails.execute(CheckPlatformDetails.java:167) [diagnostics-9.3.1.jar:9.3.1]
	at co.elastic.support.diagnostics.chain.DiagnosticChainExec.runDiagnostic(DiagnosticChainExec.java:46) [diagnostics-9.3.1.jar:9.3.1]
	at co.elastic.support.diagnostics.DiagnosticService.exec(DiagnosticService.java:92) [diagnostics-9.3.1.jar:9.3.1]
	at co.elastic.support.diagnostics.DiagnosticApp.main(DiagnosticApp.java:51) [diagnostics-9.3.1.jar:9.3.1]

outcome after the change

logs and syscalls directory are included in diagnostics bundle and diagnostics.log shows a warning about matching that relied on http publish address (likely when customer used 0.0.0.0)

12:08:01.933 [main] INFO  co.elastic.support.diagnostics.commands.CheckPlatformDetails - Checking the supplied hostname against the node information retrieved to verify location. This may take some time.
12:09:02.041 [main] WARN  co.elastic.support.diagnostics.commands.CheckPlatformDetails - Matched node 'randomname' via ip/httpPublishAddr fallback (boundAddresses did not match).

Checklist

  • I have verified that the APIs in this pull request do not return sensitive data

when using `0.0.0.0`,  the node match fails because:

- `findTargetNode()` only compares local NIC addresses against `node.boundAddresses`
- `boundAddresses` is empty for all nodes
The code never falls back to comparing against `node.httpPublishAddr` or `node.ip` — even though it's likely containing the information needed for a positively match of the node
@jguay jguay requested review from a team and pickypg as code owners July 1, 2026 11:23
@jguay jguay changed the title resolve node name fallback on published http address as fallback resolve node name fallback on published/node ip as fallback Jul 1, 2026
@pickypg

pickypg commented Jul 2, 2026

Copy link
Copy Markdown
Member

buildkite test this

@pickypg pickypg enabled auto-merge (squash) July 2, 2026 17:42
Comment on lines +108 to +115
ProcessProfile ela01 = makeNode("NTG-PRO-ELA-01", "172.16.1.61", "172.16.1.61",
new java.util.HashSet<>());
ProcessProfile ela02 = makeNode("NTG-PRO-ELA-02", "172.16.1.62", "172.16.1.62",
new java.util.HashSet<>());
ProcessProfile ela03 = makeNode("NTG-PRO-ELA-03", "172.16.1.63", "172.16.1.63",
new java.util.HashSet<>());
ProcessProfile ela04 = makeNode("NTG-PRO-ELA-04", "172.16.1.64", "172.16.1.64",
new java.util.HashSet<>());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ProcessProfile ela01 = makeNode("NTG-PRO-ELA-01", "172.16.1.61", "172.16.1.61",
new java.util.HashSet<>());
ProcessProfile ela02 = makeNode("NTG-PRO-ELA-02", "172.16.1.62", "172.16.1.62",
new java.util.HashSet<>());
ProcessProfile ela03 = makeNode("NTG-PRO-ELA-03", "172.16.1.63", "172.16.1.63",
new java.util.HashSet<>());
ProcessProfile ela04 = makeNode("NTG-PRO-ELA-04", "172.16.1.64", "172.16.1.64",
new java.util.HashSet<>());
ProcessProfile ela01 = makeNode("NTG-PRO-ELA-01", "172.16.1.61", "172.16.1.61", new HashSet<>());
ProcessProfile ela02 = makeNode("NTG-PRO-ELA-02", "172.16.1.62", "172.16.1.62", new HashSet<>());
ProcessProfile ela03 = makeNode("NTG-PRO-ELA-03", "172.16.1.63", "172.16.1.63", new HashSet<>());
ProcessProfile ela04 = makeNode("NTG-PRO-ELA-04", "172.16.1.64", "172.16.1.64", new HashSet<>());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +118 to +119
ProcessProfile result = checker.findLocalTargetNode("172.16.1.61",
List.of(ela01, ela02, ela03, ela04));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ProcessProfile result = checker.findLocalTargetNode("172.16.1.61",
List.of(ela01, ela02, ela03, ela04));
ProcessProfile result = checker.findLocalTargetNode("172.16.1.61", List.of(ela01, ela02, ela03, ela04));

Comment on lines +130 to +131
ProcessProfile node = makeNode("node-1", "10.0.0.1", "10.0.0.1",
new java.util.HashSet<>());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ProcessProfile node = makeNode("node-1", "10.0.0.1", "10.0.0.1",
new java.util.HashSet<>());
ProcessProfile node = makeNode("node-1", "10.0.0.1", "10.0.0.1", new HashSet<>());

Comment on lines +93 to +94
ProcessProfile node = makeNode("NTG-PRO-ELA-01", "10.0.0.5", "172.16.1.61",
new java.util.HashSet<>());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ProcessProfile node = makeNode("NTG-PRO-ELA-01", "10.0.0.5", "172.16.1.61",
new java.util.HashSet<>());
ProcessProfile node = makeNode("NTG-PRO-ELA-01", "10.0.0.5", "172.16.1.61", new HashSet<>());

Comment on lines +82 to +83
ProcessProfile node = makeNode("NTG-PRO-ELA-01", "172.16.1.61", "172.16.1.61",
new java.util.HashSet<>());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ProcessProfile node = makeNode("NTG-PRO-ELA-01", "172.16.1.61", "172.16.1.61",
new java.util.HashSet<>());
ProcessProfile node = makeNode("NTG-PRO-ELA-01", "172.16.1.61", "172.16.1.61", new HashSet<>());

Comment on lines +67 to +70
ProcessProfile node1 = makeNode("node-1", "10.0.0.1", "10.0.0.1",
new java.util.HashSet<>(Set.of("10.0.0.1")));
ProcessProfile node2 = makeNode("node-2", "10.0.0.2", "10.0.0.2",
new java.util.HashSet<>(Set.of("10.0.0.2")));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ProcessProfile node1 = makeNode("node-1", "10.0.0.1", "10.0.0.1",
new java.util.HashSet<>(Set.of("10.0.0.1")));
ProcessProfile node2 = makeNode("node-2", "10.0.0.2", "10.0.0.2",
new java.util.HashSet<>(Set.of("10.0.0.2")));
ProcessProfile node1 = makeNode("node-1", "10.0.0.1", "10.0.0.1", new HashSet<>(Set.of("10.0.0.1")));
ProcessProfile node2 = makeNode("node-2", "10.0.0.2", "10.0.0.2", new HashSet<>(Set.of("10.0.0.2")));

Comment on lines +53 to +54
ProcessProfile node = makeNode("NTG-PRO-ELA-01", "172.16.1.61", "172.16.1.61",
new java.util.HashSet<>());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ProcessProfile node = makeNode("NTG-PRO-ELA-01", "172.16.1.61", "172.16.1.61",
new java.util.HashSet<>());
ProcessProfile node = makeNode("NTG-PRO-ELA-01", "172.16.1.61", "172.16.1.61", new HashSet<>());

@pickypg pickypg merged commit 9f4895e into elastic:main Jul 2, 2026
7 checks passed
@jguay jguay deleted the fallback-published-address-for-node-matching branch July 3, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a flag to force running system calls

2 participants